{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "d:\\project\\python\\neuron-vis\\figures/../neuronVis\\./plugins/fnt_libpy.dll\n"
     ]
    }
   ],
   "source": [
    "import sys,copy,os,inspect\n",
    "if hasattr(sys.modules[__name__], '__file__'):\n",
    "    _file_name = __file__\n",
    "else:\n",
    "    _file_name = inspect.getfile(inspect.currentframe())\n",
    "CURRENT_FILE_PATH = os.path.dirname(_file_name)\n",
    "sys.path.append(os.getcwd()+\"/../neuronVis\")\n",
    "import pandas as pd\n",
    "import Scene\n",
    "import BrainRegion as BR \n",
    "import IONData ,volume\n",
    "iondata = IONData.IONData()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "99c0293a911b462daf6af37a78a152c6",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "RFBOutputContext()"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "finished 1/27\n",
      "finished 2/27\n",
      "finished 3/27\n",
      "finished 4/27\n",
      "finished 5/27\n",
      "finished 6/27\n",
      "finished 7/27\n",
      "finished 8/27\n",
      "finished 9/27\n",
      "finished 10/27\n",
      "finished 11/27\n",
      "finished 12/27\n",
      "finished 13/27\n",
      "finished 14/27\n",
      "finished 15/27\n",
      "finished 16/27\n",
      "finished 17/27\n",
      "finished 18/27\n",
      "finished 19/27\n",
      "finished 20/27\n",
      "finished 21/27\n",
      "finished 22/27\n",
      "finished 23/27\n",
      "finished 24/27\n",
      "finished 25/27\n",
      "finished 26/27\n",
      "finished 27/27\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "d:\\Program Files\\anaconda3\\envs\\neuronVis\\lib\\site-packages\\vispy\\gloo\\texture.py:28: UserWarning: GPUs can't support floating point data with more than 32-bits, precision will be lost due to downcasting to 32-bit float.\n",
      "  warnings.warn(F64_PRECISION_WARNING)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[726.0]\n"
     ]
    }
   ],
   "source": [
    "import vispy.io as io\n",
    "cube = volume.FNTCube()\n",
    "cube.setSampleID('210726')\n",
    "    # cube.setMouseCoord(6719.08,2002.89,4665.78) # cortex\n",
    "    # cube.setMouseCoord(6220.28,3380.16,6409.23) # th\n",
    "    # cube.setMouseCoord(6016.28,3820.16,6315.23) # th\n",
    "cube.setMouseCoord(3316.73,4630.76,5811.05) # th\n",
    "cube.radiu=2\n",
    "\n",
    "    # cube.setMouseCoord(3459.95,1743.75,6370.94) #mean=137\n",
    "    \n",
    "render = volume.VolumeRender()\n",
    "render.setFNTCube(cube)\n",
    "render.volume1.clim=(20,1000)\n",
    "volume.app.run()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "../resource/swc_raw/210726/004.swc  downloaded\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "3034af79b15446a3a35806c3e20d1322",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "RFBOutputContext()"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "D:\\project\\python\\AppData\\Local\\Temp\\tmpyuza8ow9.hevc\n",
      "finished 1/1\n",
      "[726.0]\n",
      "help\n"
     ]
    }
   ],
   "source": [
    "import sys,copy,os,inspect\n",
    "if hasattr(sys.modules[__name__], '__file__'):\n",
    "    _file_name = __file__\n",
    "else:\n",
    "    _file_name = inspect.getfile(inspect.currentframe())\n",
    "CURRENT_FILE_PATH = os.path.dirname(_file_name)\n",
    "sys.path.append(os.getcwd()+\"/../neuronVis\")\n",
    "import pandas as pd\n",
    "import Scene\n",
    "import BrainRegion as BR \n",
    "import IONData ,volume\n",
    "iondata = IONData.IONData()\n",
    "\n",
    "import vispy.io as io\n",
    "cube = volume.FNTCube()\n",
    "cube.setSampleID('210726')\n",
    "    # cube.setMouseCoord(6719.08,2002.89,4665.78) # cortex\n",
    "    # cube.setMouseCoord(6220.28,3380.16,6409.23) # th\n",
    "    # cube.setMouseCoord(6016.28,3820.16,6315.23) # th\n",
    "cube.setMouseCoord(3316.73,4630.76,5811.05) # th\n",
    "cube.radiu=1\n",
    "# vol1 =cube.getVolume()\n",
    "    # cube.setMouseCoord(3459.95,1743.75,6370.94) #mean=137\n",
    "\n",
    "tree = iondata.getRawNeuronTreeByID('210726','004.swc')\n",
    "render = volume.VolumeRender()\n",
    "render.setFNTCube(cube)\n",
    "segments=[]\n",
    "for edge in tree.edges[:]:\n",
    "    p=[]\n",
    "    for point in edge.data:\n",
    "        p.append(point.xyz)\n",
    "    segments.append(p)\n",
    "render.drawSegments(segments)\n",
    "render.volume1.clim=(20,1000)\n",
    "volume.app.run()\n",
    "# %%\n",
    "print('help')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "neuronVis",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
